<?php
session_start();
ob_start();
if (!isset($_SESSION['loggedin'])) {

    header('Location: login.php');
}
?>
<?php include 'index.php';
include '../connection.php';

?>



<div id="body-wrapper">

    <div id="main-content">
	<div class="content-box">
		
		  <div class="content-box-header">

                <h3><?= Most_Visits ?></h3>

                <div class="clear"></div>

            </div> 

       

	 

           
                    
              

                    <table>
                        <thead>
                            <tr>
                              
                                <th><?= name ?></th>
                                <th><?= username ?></th>
								<th><?= registeredDate ?></th>
								<th><?= email ?></th>
								<th><?= visits ?></th>
								
                            </tr>
                        </thead>
						
				

                        <tbody>
                          
                         
                         
                          
                              <?php 
							



							  $sql = "SELECT u.first , u.last , u.uname , u.email , u.registeredDate , a.visit_num
									  FROM active_users a, users u
								   	  WHERE a.id = u.id
									  order by a.visit_num desc
									  LIMIT 0 , 5";

							 
							  $result = mysql_query($sql);
							  while ($row = mysql_fetch_array($result)) {
							  
								?>
							  <tr>
							  <td><?= $row['first'] . ' ' . $row['last']?></td>
							  <td><?= $row['uname']?></td>
							  <td><?= $row['registeredDate']?></td>
							  <td><?= $row['email']?></td>
							  <td><?= $row['visit_num']?></td>
							  </tr>
							  <?php
					       	}//end while 
									
									?>
									
									
								
									    
									
									  

                              
						
                        </tbody>
						

                    </table>
					
					
						
						
                </div> 
				
			

            </div> 

        </div> 





    </div> <!-- End #main-content -->

</div>